package com.blackcat.annotation.resource.config;

import com.blackcat.annotation.resource.dao.UserDao;
import org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

/**
 * <p> 描述 :
 * @author : blackcat
 * @date  : 2020/5/25 17:45
*/
@Configuration
@ComponentScan(basePackages = "com.blackcat.annotation.resource")
public class MyConfig {

	/**
	 * Resource功能和@AutoWired的功能差不多一样，但是不支持@Primary 和 @Qualifier的支持
	 */
	@Primary
	@Bean
	public UserDao userDao2() {
		UserDao userDao = new UserDao();
		userDao.setFlag(2);
		return userDao;
	}
}
